#include "DayTime_t.h"

DayTime_t::DayTime_t()
	: m_day(Day_t::Undefined)
	, m_hours(0)
	, m_minutes(0)
{
}

DayTime_t::DayTime_t(const Day_t& day, size_t hours, size_t minutes)
	: m_day(Day_t::Undefined)
	, m_hours(0)
	, m_minutes(0)
{
	if(!setDay(day) || !setHours(hours) || !setMinutes(minutes))
		throw "DayTime_t: Ctor parameters error";
}

DayTime_t::~DayTime_t()
{
}

DayTime_t::DayTime_t(const DayTime_t& other)
	: m_day(other.m_day)
	, m_hours(other.m_hours)
	, m_minutes(other.m_minutes)
{
}

DayTime_t& DayTime_t::operator=(const DayTime_t& other)
{
	if(this != &other)
	{
		m_day = other.m_day;
		m_hours = other.m_hours;
		m_minutes = other.m_minutes;
	}

	return *this;
}

bool DayTime_t::operator==(const DayTime_t& other) const
{
	return (m_day == other.m_day &&
		    m_hours == other.m_hours &&
			m_minutes == other.m_minutes);
}

bool DayTime_t::operator!=(const DayTime_t& other) const
{
	return !(*this == other);
}

bool DayTime_t::operator<=(const DayTime_t& other) const
{
	if(m_day > other.m_day)
		return false;

	if(m_day < other.m_day)
		return true;

	if(m_hours > other.m_hours)
		return false;

	if(m_hours < other.m_hours)
		return true;

	if(m_minutes > other.m_minutes)
		return false;

	return true;
}

bool DayTime_t::operator<(const DayTime_t& other) const
{
	return *this <= other && *this != other;
}